<?php

namespace apiend\modules\passport\models;

use Yii;
use yii\base\Exception;
use common\models\app\AppToken;
use common\models\app\AppDevice;
use common\models\app\AppClient;
use common\models\app\AppVersion;
use common\models\user\UserMeta;
use common\models\user\UserConnect;
use common\helpers\ArrayHelper;
use common\helpers\IpHelper;
use apiend\models\User;
use youmbe\rbac\components\MenuHelper;

/**
 * 微信小程序接口访问授权接口
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class AuthMenuSearch extends \youmbe\rbac\models\Menu {

    public static function routers() {
        return [];
        $authMenus = MenuHelper::getAssignedMenu2(Yii::$app->user->id);
        return $authMenus;
        $query = static::find()->alias('m');
        $query->with('parent');
        $menus = $query->all();
        return [
            [
                "id" => 1,
                "parent_id" => 0,
                "label" => "商城管理",
                "icon" => "shop",
                "type" => "M",
                "url" => "#",
                "children" => [
                    [
                        "id" => 11,
                        "parent_id" => 1,
                        "label" => "基础设置",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/shop/default/index",
                    ],
                    [
                        "id" => 12,
                        "parent_id" => 1,
                        "label" => "基础设置",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/shop/default/index",
                    ],
                    [
                        "id" => 12,
                        "parent_id" => 1,
                        "label" => "添加商品",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/shop/create",
                    ]
                ],
            ],
            [
                "id" => 2,
                "parent_id" => 0,
                "label" => "商品管理",
                "icon" => "mall",
                "type" => "M",
                "url" => "#",
                "children" => [
                    [
                        "id" => 21,
                        "parent_id" => 2,
                        "label" => "商品列表",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/commodity/index",
                    ],
                    [
                        "id" => 22,
                        "parent_id" => 2,
                        "label" => "添加商品",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/commodity/create",
                    ]
                ],
            ],
            [
                "id" => 3,
                "parent_id" => 0,
                "label" => "系统管理",
                "icon" => "system",
                "type" => "M",
                "url" => "#",
                "children" => [
                    [
                        "id" => 31,
                        "parent_id" => 3,
                        "label" => "菜单管理",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/system/menu",
                    ],
                    [
                        "id" => 32,
                        "parent_id" => 3,
                        "label" => "通讯录管理",
                        "type" => "C",
                        "icon" => "",
                        "url" => "/excel/select-excel",
                    ]
                ],
            ],
        ];
    }

}
